/*
@hehung
2023-2-8
转载请注明出处，版权由@hehung所有
email: 1398660197@qq.com
wechat: hehung95
*/

#include "hal_data.h"
#include "app_led.h"

#define LED_DEBUG
#undef LED_DEBUG

#ifdef LED_DEBUG
#include <stdio.h>
#endif

#define LED_ON                     (BSP_IO_LEVEL_HIGH)
#define LED_OFF                    (BSP_IO_LEVEL_LOW)


static bsp_io_port_pin_t led_pin[LED_TOTAL_NUM] = 
{
	BSP_IO_PORT_04_PIN_05,
	BSP_IO_PORT_04_PIN_04,
	BSP_IO_PORT_00_PIN_02
};



void Led_Ctrl(uint8_t led_num, uint8_t led_level)
{
    (void)R_IOPORT_PinWrite(&g_ioport_ctrl, led_pin[led_num], (bsp_io_level_t)led_level);
}

void Led_Toggle(uint8_t led_num)
{
    bsp_io_level_t led_value_r;
    bsp_io_level_t led_value_w;

    (void)R_IOPORT_PinRead(&g_ioport_ctrl, led_pin[led_num], &led_value_r);

	if (BSP_IO_LEVEL_LOW == led_value_r)
    {
        led_value_w = BSP_IO_LEVEL_HIGH;
    }
    else
    {
        led_value_w = BSP_IO_LEVEL_LOW;
    }

    (void)R_IOPORT_PinWrite(&g_ioport_ctrl, led_pin[led_num], (bsp_io_level_t)led_value_w);
}

void Led_Init(void)
{

}

